// pages/my/my.js
const app = getApp()
import http from "../../utils/http"
import util from "../../utils/util"
Page({

  /**
   * 页面的初始数据
   */
  data: {
    moreList:[
      {img:'../../static/index/my/my-5.png',title:'加入商家',url:'/service/merchant/merchant'},
      {img:'../../static/index/my/my-7.png',title:'提现绑定',url:'/service/account/account'},
      {img:'../../static/index/my/my-8.png',title:'平台公告',url:'/service/notice/notice'},
      {img:'../../static/index/my/my-9.png',title:'我的评价',url:'/service/comments/comments'},
      {img:'../../static/index/my/my-10.png',title:'培训中心',url: '/service/exercise/exercise'},
      {img:'../../static/index/my/my-11.png',title:'联系客服'},
      {img:'../../static/index/my/my-12.png',title:'意见反馈',url:'/service/feedback/feedback'},
    ],
    info: '',
    config: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },
  onLoadConfig(option){
    this.setData({
      config: app.globalData.config
    })
  },
  toserve(){
    util.authSkip('/service/serveList/serveList')
  },
  // 跳转信用
  tocredit(){
    util.authSkip('/service/credit/credit')
  },
  // 跳转余额
  toBalance(e){
    util.authSkip('/service/balance/balance?type='+e.currentTarget.dataset.type)
  },
  // 跳转保证金
  toEarnestMoney(){
    util.authSkip('/service/earnestMoney/earnestMoney')
  },
  toSet(){
    util.authSkip('/service/set/set')
  },
  toLogin(){
    util.skip('/service/login/login')
  },
  toServel(e){
    util.authSkip(e.currentTarget.dataset.url)
  },
  getInfo(){
    if(!wx.getStorageSync('token')) return
    http.get('skill/skillindex','',!this.data.info).then(res => {
      this.data.moreList[3].url = '/service/comments/comments?type=skill&id='+res.data.skill.id
      this.setData({
        info: res.data,
        moreList: this.data.moreList
      })
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    this.getInfo()
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})